Having local packages in a monorepo depend on one another

Just like you did Pkg.develop to add the packages to your global environment (~/.julia/environments/1.5) you should use Pkg.develop when you add them as dependencies of each other. Here is an example:

Generate two local packages:

$ jlpkg generate A; jlpkg generate B
 Generating  project A ...
 Generating  project B ...

Add them with develop and the path:

$ jlpkg --project=. dev A B # Add both to "global env"
  Resolving package versions...
Updating `/tmp/Project.toml`
  [a8860211] + A v0.1.0 `A`
  [c725e7a7] + B v0.1.0 `B`
Updating `/tmp/Manifest.toml`
  [a8860211] + A v0.1.0 `A`
  [c725e7a7] + B v0.1.0 `B`

Manifest looks good:

$ cat Manifest.toml 
# This file is machine-generated - editing it directly is not advised

[[A]]
path = "A"
uuid = "a8860211-dfc0-462f-9fbf-c3432d7e395f"
version = "0.1.0"

[[B]]
path = "B"
uuid = "c725e7a7-9ad5-4b2e-b018-0ca07287f03e"
version = "0.1.0"

Add B as a dependency to the A project:

$ jlpkg --project=A dev B # Add B as a dependency to A
  Resolving package versions...
Updating `/tmp/A/Project.toml`
  [c725e7a7] + B v0.1.0 `../B`
Updating `/tmp/A/Manifest.toml`
  [c725e7a7] + B v0.1.0 `../B`

Sync the global manifest to update A’s dependencies

$ jlpkg --project=. resolve # Sync the global manifest
[...]

Make sure A properly depends on B:

$ cat Manifest.toml 
# This file is machine-generated - editing it directly is not advised

[[A]]
deps = ["B"]
path = "A"
uuid = "a8860211-dfc0-462f-9fbf-c3432d7e395f"
version = "0.1.0"

[[B]]
path = "B"
uuid = "c725e7a7-9ad5-4b2e-b018-0ca07287f03e"
version = "0.1.0"
3 Likes